package com.jshop.servlet.category;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jshop.entity.JSHOP_CATEGORY;
import com.jshop.service.JSHOP_CATE_DAO;

@WebServlet("/backstage/admin_docateupdate")
public class DoCateUpdate extends HttpServlet {

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=utf-8");
		
		int cateid = Integer.parseInt(request.getParameter("cateid"));
		int cateparent = Integer.parseInt(request.getParameter("cateparent"));
		String catename = request.getParameter("catename");
		
		JSHOP_CATEGORY category = new JSHOP_CATEGORY(cateid,catename,cateparent);
		JSHOP_CATE_DAO.update(category);
		
		response.sendRedirect("admin_docateselect");
	
	}

}
